//
//  XTUserModel.swift
//  XTMuteOpen
//
//  Created by bushAK on 2024/1/22.
//

import UIKit

class XTUserModel: NSObject, NSCoding {

    @objc var uid = ""
    @objc var role = ""
    @objc var regist_date = ""
    @objc var token = ""
    @objc var avatar = ""
    @objc var phonenumber = ""
    @objc var username = ""

    override init() {
        super.init()
    }
    // 归档
    func encode(with coder: NSCoder) {
        coder.encode(uid, forKey: "uid")
        coder.encode(role, forKey: "role")
        coder.encode(regist_date, forKey: "regist_date")
        coder.encode(token, forKey: "token")
        coder.encode(avatar, forKey: "avatar")
        coder.encode(phonenumber, forKey: "phonenumber")
        coder.encode(username, forKey: "username")
    }

    // 解档
    required init?(coder: NSCoder) {
        uid = coder.decodeObject(forKey: "uid") as? String ?? ""
        role = coder.decodeObject(forKey: "role") as? String ?? ""
        regist_date = coder.decodeObject(forKey: "regist_date") as? String ?? ""
        token = coder.decodeObject(forKey: "token") as? String ?? ""
        avatar = coder.decodeObject(forKey: "avatar") as? String ?? ""
        phonenumber = coder.decodeObject(forKey: "phonenumber") as? String ?? ""
        username = coder.decodeObject(forKey: "username") as? String ?? ""
    }
}
